import 'package:flutter/material.dart';

//1.StatefulWidget, State.setState
void main() {
  runApp(TestState1());
}


class TestState1 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Row(
      children: const <Widget>[
        // RaisedButton(
        //   onPressed: null,
        //   child:  Text(' ADD '),
        // ),
        Text('Count: '),
      ],
    );
  }
}

class TestFulWidget extends StatefulWidget {
  const TestFulWidget({Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return TestState();
  }
}

class TestState extends State {
  var increate1 = 0;
  void increateMethod() {
    setState(() {
      increate1++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Row(
      children: <Widget>[
        RaisedButton(
          onPressed: increateMethod,
          child: const Text(' ADD '),
        ),
        Text('Count: $increate1'),
      ],
    );
  }
}

